<h1 class="heading">
    <?php 
    //$row = $wpdb->get_row("SELECT name from ".$wpdb->prefix."terms WHERE term_id = " . $cs_news_cat_db );
    //echo $row->name; 
	echo $cs_news_title_db;
    ?>
</h1>
<div class="in-sec">
    <!-- News List Start -->				
    <ul class="news-list">
	<?php
		if ( empty($_GET['page_id_all']) ) $_GET['page_id_all'] = 1;
		$count_post = 0;
		query_posts( array( 'posts_per_page' => '-1', 'post_type' => 'post', 'category_name' => "$cs_news_cat_db" ) );
			while ( have_posts()) : the_post();
				$count_post++;
			endwhile;
			if ( $cs_news_pagination_db == "Single Page" ) $cs_news_num_post_db = -1;
	
			query_posts( array( 'posts_per_page' => "$cs_news_num_post_db", 'paged' => $_GET['page_id_all'], 'category_name' => "$cs_news_cat_db" ) ); 
			$counter = 0;
			while ( have_posts()) : the_post();
				$image_id = get_post_thumbnail_id ( $post->ID );?>
				<li class="<?php if ($image_id == ''){echo 'no-image';}?>">
                <?php if ($image_id){
					//$image_url = wp_get_attachment_image_src($image_id, array(580,244),true);
					$image_url = cs_attachment_image_src($image_id, 580, 244);
				?>
                    
                    <div class="news-thumb">
                        <a href="<?php echo get_permalink();?>" class="thumb">
                            <?php
                                // getting featured image start
                                    echo "<img src='".$image_url."' />";
                                // getting featured image end								
                            ?>
                        <span class="featured">Latest News</span></a>
                    </div>
                    <?php }?>
                    <div class="news-desc">
                        <div class="date">
                            <h1><?php echo get_the_date();?></h1>									
                        </div>
                        <div class="desc">
                            <h4><a href="<?php echo get_permalink();?>"><?php echo get_the_title();?></a></h4>
                            <p class="txt">
                                <?php
                                    //$get_the_excerpt = trim(preg_replace('/<a[^>]*>(.*)<\/a>/iU','', get_the_content()));
                                    //$get_the_excerpt = trim(preg_replace('/<a[^>]*>(.*)<\/a>/iU','', the_excerpt()));
                                    if ( $post->post_excerpt <> "" ) $get_the_excerpt = $post->post_excerpt;
                                    else $get_the_excerpt = $post->post_content;
                                        $get_the_excerpt = trim(preg_replace('/<a[^>]*>(.*)<\/a>/iU','', $get_the_excerpt ));
                                        echo substr($get_the_excerpt, 0, "$cs_news_excerpt_db");
                                        if ( strlen( $get_the_excerpt ) > "$cs_news_excerpt_db" ) {
                                            echo '... <a href="'.get_permalink().'"> Read more</a>';
                                        }
                                ?>
                            </p>
                        </div>
                    </div>
                </li>
			<?php endwhile;?>
        </ul>
        <!-- News List End -->
</div>
<?php
	// pagination start
	if ( $cs_news_pagination_db == "Show Pagination" and $cs_news_num_post_db > 0 ) {
		echo "<div class='in-sec'><ul class='pagination'>";
			$qrystr = '';
			if ( isset($_GET['page_id']) ) $qrystr = "&page_id=".$_GET['page_id'];		
		echo cs_pagination($count_post, $cs_news_num_post_db,$qrystr);
		echo "</ul></div>";
	}
	// pagination end
?>